﻿@model PNProject.Core.NewsModel
@using PNProject;
@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/AdminLayout.cshtml";
    int i = 0;
}

<div class="admin_head">
Tạo mới bài viết
</div>
<script src="/Scripts/jquery-1.5.1.js" type="text/javascript"></script>

<div class="admin_content">

@using (Html.BeginForm("Create", "AdminArticle", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)
    <fieldset>
    @Html.HiddenFor(a=>a.Lang)
    @Html.HiddenFor(a=>a.Short)
    @Html.HiddenFor(a=>a.ContentVN)
    @Html.HiddenFor(a=>a.CommentAllow)
        <legend>Form nhập - Tin tức</legend>
<div class="title">
<img src="/Images/Base/chimuc.jpg" style="margin-right:10px; margin-bottom:1px;"/>Ngôn ngữ
</div>
<div>
<select id="select_lang">
<option value="0">Tiếng Việt</option>
<option value="1">Tiếng Anh</option>
</select>
</div>
<br />
<div class="title">
<img src="/Images/Base/chimuc.jpg" style="margin-right:10px; margin-bottom:1px;"/>Tiêu đề
</div>
<div class="editor-field">
        @Html.EditorFor(model => model.Title)
</div>
<br />
<div class="title">
<img src="/Images/Base/chimuc.jpg" style="margin-right:10px; margin-bottom:1px;"/>Tóm tắt
</div>
<div class="editor-field">
        <textarea id="tomtat"></textarea>
</div>
<br />
<div class="title">
<img src="/Images/Base/chimuc.jpg" style="margin-right:10px; margin-bottom:1px;"/>Nội dung
</div>
<textarea class="ckeditor" id="editor1" rows="10" style="width:540px; height:300px; overflow-x:hidden;"></textarea>
<br />
<div class="title">
<img src="/Images/Base/chimuc.jpg" style="margin-right:10px; margin-bottom:1px;"/>Hình đại diện
</div>
<div>
<input type="file" name="file" />
<div class="title">
Chọn hình từ internet
</div>
<div class="editor-field">
        @Html.EditorFor(model => model.Avatar)
</div>
</div>
<br />

<div class="title">
File đính kèm <span style="color:Red">(*.doc, *.docx, *.pdf, *.ppt, *.xls, *.xlsx, *.jpg, *.jpeg, *.png, *.gif )</span><br />
<input type="file" name="attach" />
</div>
<br />
<div class="title">
<img src="/Images/Base/chimuc.jpg" style="margin-right:10px; margin-bottom:1px;"/>Cho phép bình luận
</div>

<div>
<select id="select_allow">
<option value="0">Cho phép</option>
<option value="1">Không</option>
</select>
</div>

        <p>
            <input id="main-submit" type="submit" value="Tạo mới" />
        </p>
</fieldset>
}


</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("#main-submit").click(function () {
            var value1 = CKEDITOR.instances['editor1'].getData();
            var lang = $(select_lang).val();
            if (lang == "0") {
                $("#Lang").val("True");
            }
            else {
                $("#Lang").val("False");
            }
            $("#Short").val($(tomtat).val());
            $("#ContentVN").val(value1);

            var allow = $(select_allow).val();
            if (allow == "0") {
                $("#CommentAllow").val("True");
            }
            else {
                $("#CommentAllow").val("False");
            }
        });
    });
</script>

